import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Casey
 *
 */
public class offerTests {
	
	private Offer offer;
	private ValidationController vc;
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		vc = new ValidationController();
		offer = new Offer("Steve Rogers",	// trader name
				10, 						// trade id
				Database.ORE.GOLD,			// ore name
				1,							// ore quantity
				"BUY",						// offer type
				1);							// price
		
		ArrayList<Database.ORE> oreNames = new ArrayList<Database.ORE>();
		oreNames.add(Database.ORE.GOLD);
		ArrayList<Integer> oreValues = new ArrayList<Integer>();
		oreValues.add(1);
		ValidationController.db.addTrader("Steve Rogers", 10000, oreNames, oreValues);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		ValidationController.db.removeTrader("Steve Rogers");
	}

	@Test
	public void test() {
		fail("Not yet implemented");
	}
	
	@Test
	public void traderExistsInDB() {
		assertTrue("Trader does not exist in database.", offer.isTraderValid());
	}
	
	@Test
	public void orenameExistsInDB() {
		assertTrue("Ore does not exist in database.", offer.isOreNameValid());
	}
	
	@Test
	public void checkOreQuantity() {
		assertTrue("Ore quantity is not postive.", offer.isOreQuantityPositive());
	}
	
	@Test
	public void canAnyoneAffordOffer() {
		assertTrue("Nobody can afford this offer.", offer.canAnyTraderAffordThis());
	}
	
	@Test
	public void canYouAffordOffer() {
		assertTrue("This trader cannot afford this offer.", offer.canThisTraderAffordThis());
	}
	
	@Test
	public void checkPrice() {
		assertTrue("The price is not greater than or equal to zero.", offer.isPriceGreaterOrEqualToZero());
	}

}
